package com.guohe3.just.task;

import com.guohe3.just.service.impl.MailServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @author 浦希成
 * 2019-01-14
 */
@Component
public class AsyncTask {
    @Autowired
    private MailServiceImpl mailService;

    @Async("commonPoolTaskExecutor")// 使用自定义的线程池
    public void sendMail(String text) {
        mailService.sendTextMail(text);
    }
}
